﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Demo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["najava"] == null)
            {
                Response.Redirect("~/Najava.aspx");
            }
            else
            {
                BankaReference.Banka bank = new BankaReference.Banka();

                lblplayerToken.Text = Session["najava"].ToString();
                lblplayerBalance.Text = Convert.ToInt32(bank.showBalance(lblplayerToken.Text))+"";
            }
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       
        if (Session["najava"] == null)
        {
            Response.Redirect("~/Najava.aspx");
        }
        else
        {
            BankaReference.Banka bank = new BankaReference.Banka();
            bank.withdrawMoney(Session["najava"].ToString(), Convert.ToInt32(txtPovleciPari.Text));
            Response.Redirect("~/Demo.aspx");
        }
        
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (Session["najava"] == null)
        {
            Response.Redirect("~/Najava.aspx");
        }
        else
        {
            BankaReference.Banka bank = new BankaReference.Banka();
            bank.depositMoney(Session["najava"].ToString(), Convert.ToInt32(txtStaviPari.Text));
            Response.Redirect("~/Demo.aspx");
        }
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        Session.Remove("najava");
        Response.Redirect("~/Najava.aspx");
    }
}